/*
 *
 *  Copyright (C) 2007-2020 SimplyCore, LLC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *
 */

#include "usbd.h"
#if KERNEL_GT_EQ((0x235+5344-0x1713),(0x1db7+2234-0x266b),(0x4a+4635-0x1246))
int llIIllIII(struct lIlIIlIl*IllIlI,size_t length,int llIlllIl){int i;size_t 
lllllIlll=lllIIlI-(lllIIlI%llIlllIl);int num_sgs=(length+lllllIlll-
(0x1093+1452-0x163e))/lllllIlll;struct scatterlist*sg;
#if KERNEL_LT_EQ((0x31c+4078-0x1308),(0x1254+3075-0x1e51),(0x94+5701-0x16b7)) 

int lIIIIlIIl=((PAGE_SIZE-sizeof(*IllIlI->llIIIII))&~((0xb93+3306-0x1875)-
(0x3a0+3871-0x12be)))/sizeof(*IllIlI->sg);
#else

int lIIIIlIIl=PAGE_SIZE/sizeof(*IllIlI->sg);
#endif
if(num_sgs>lIIIIlIIl){IlllI(
"\x75\x73\x62\x64\x5f\x73\x67\x5f\x61\x6c\x6c\x6f\x63\x3a\x20\x74\x6f\x6f\x20\x6c\x61\x72\x67\x65" "\n"
);return-EOVERFLOW;}IllIlI->num_sgs=num_sgs;
#if KERNEL_LT_EQ((0x3f6+8274-0x2446),(0x804+4430-0x194c),(0xe7b+6121-0x2642)) 

IllIlI->sg=IlllIIl(ALIGN(num_sgs*sizeof(*IllIlI->sg),sizeof(void*))+sizeof(*
IllIlI->llIIIII),GFP_KERNEL);IllIlI->llIIIII=(struct usb_sg_request*)((char*)
IllIlI->sg+ALIGN(num_sgs*sizeof(*IllIlI->sg),(0x1691+1623-0x1ce0)));IllIlI->
llIIIII->sg=IllIlI->sg;
#else

IllIlI->sg=IlllIIl(num_sgs*sizeof(*IllIlI->llIIIII),GFP_KERNEL);IllIlI->llIIIII=
IllIlI->sg;
#endif
if(IllIlI->sg==NULL){IlllI(
"\x75\x73\x62\x64\x5f\x73\x67\x5f\x61\x6c\x6c\x6f\x63\x3a\x20\x73\x67\x20\x61\x6c\x6c\x6f\x63\x20\x66\x61\x69\x6c\x65\x64\x28\x31\x29" "\n"
);return-ENOMEM;}sg_init_table(IllIlI->sg,IllIlI->num_sgs);for_each_sg(IllIlI->
sg,sg,IllIlI->num_sgs,i){size_t IIIllIl=min(length,lllllIlll);void*IIIllIllI=
IIIllII(IIIllIl,GFP_KERNEL);if(IIIllIllI==NULL){break;}sg_set_buf(sg,IIIllIllI,
IIIllIl);length-=IIIllIl;}if(i<IllIlI->num_sgs){IlllI(
"\x75\x73\x62\x64\x5f\x61\x6c\x6c\x6f\x63\x5f\x6e\x5f\x63\x6f\x70\x79\x5f\x70\x61\x72\x74\x69\x6f\x74\x69\x6f\x6e\x65\x64\x5f\x75\x6e\x72\x62\x3a\x20\x73\x67\x20\x61\x6c\x6c\x6f\x63\x20\x66\x61\x69\x6c\x65\x64\x28\x32\x29" "\n"
);IllIlI->num_sgs=i;IlllIIIIl(IllIlI);return-ENOMEM;}return(0x48b+5935-0x1bba);}
void IlllIIIIl(struct lIlIIlIl*IllIlI){if(IllIlI->sg){int i;struct scatterlist*
sg;for_each_sg(IllIlI->sg,sg,IllIlI->num_sgs,i){lIlIll(sg_virt(sg));}lIlIll(
IllIlI->sg);}IllIlI->sg=NULL;IllIlI->llIIIII=NULL;IllIlI->num_sgs=
(0x8b9+841-0xc02);}size_t IlIIIIlll(struct lIlIIlIl*IllIlI,const void __user*
IllIl,size_t length){int i;size_t IlIlI=(0x357+2345-0xc80);struct scatterlist*sg
;for_each_sg(IllIlI->sg,sg,IllIlI->num_sgs,i){size_t IlIlIlI;if(length==
(0x619+1982-0xdd7)){break;}IlIlIlI=min((size_t)sg->length,length);if(
__copy_from_user(sg_virt(sg),IllIl,IlIlIlI)){break;}length-=IlIlIlI;IllIl+=
IlIlIlI;IlIlI+=IlIlIlI;}return IlIlI;}size_t lIIIlIlII(struct lIlIIlIl*IllIlI,
void __user*IllIl,size_t length){int i;size_t IlIlI=(0x1411+3762-0x22c3);struct 
scatterlist*sg;for_each_sg(IllIlI->sg,sg,IllIlI->num_sgs,i){size_t IlIlIlI;if(
length==(0x3a9+6062-0x1b57)){break;}IlIlIlI=min((size_t)sg->length,length);if(
__copy_to_user(IllIl,sg_virt(sg),IlIlIlI)){break;}length-=IlIlIlI;IllIl+=IlIlIlI
;IlIlI+=IlIlIlI;}return IlIlI;}
#endif 

